package demo;

/**
 * finally demo
 *
 * @author dingwen
 * 2021.06.09 14:10
 */
public class FinallyDemo {
    public static void main(String[] args) {
        System.out.println("test1() = " + test1());
    }

    private static int test1() {
        int a = 0;

        try {
            a = 1;
//            int c = 1/0;
            return a;
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        } finally {
            a = 2;
            return a;
        }
    }
}
